<template>
  <div class="admin-layout">
    <!-- 侧边导航栏 -->
    <aside class="admin-sidebar">
      <div class="sidebar-header">
        <h2>后台管理</h2>
      </div>
      <nav class="sidebar-menu">
        <div class="nav-item">
          <router-link
            to="/backIndex/users"
            class="nav-link"
            active-class="active"
          >
            <span>用户管理</span>
          </router-link>
        </div>
        <div class="nav-item">
          <router-link
            to="/backIndex/products"
            class="nav-link"
            active-class="active"
          >
            <span>商品管理</span>
          </router-link>
        </div>
        <div class="nav-item">
          <router-link
            to="/backIndex/orders"
            class="nav-link"
            active-class="active"
          >
            <span>订单管理</span>
          </router-link>
        </div>
      </nav>
    </aside>

    <!-- 主内容区域 -->
    <main class="admin-content">
      <div class="content-header">
        <h1>欢迎来到后台管理系统</h1>
      </div>
      <router-view />
    </main>
  </div>
</template>

<script setup>
// 这里可以添加任何需要的脚本逻辑
</script>

<style lang="less">
.admin-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.admin-sidebar {
  width: 250px;
  background-color: #2c3e50;
  color: #ecf0f1;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid #34495e;
  background-color: #34495e;
}

.sidebar-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
}

.nav-item {
  display: block;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  color: #ecf0f1;
  text-decoration: none;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
  font-size: 16px;
}

.nav-link:hover {
  background-color: #34495e;
  border-left-color: #3498db;
}

.nav-link.active {
  background-color: #3498db;
  border-left-color: #3498db;
  color: #ffffff;
}

.admin-content {
  flex: 1;
  background-color: #f5f5f5;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.content-header {
  padding: 20px;
  background-color: #ffffff;
  border-bottom: 1px solid #e0e0e0;
}

.content-header h1 {
  margin: 0;
  font-size: 24px;
  color: #2c3e50;
}

.content-body {
  flex: 1;
  padding: 20px;
}
</style>
